home *** CD-ROM | disk | FTP | other *** search
/ GameSpot.it / GameSpot Italia (2001).bin / demo / severancedemo / data1.cab / Program_Files / Maps / Ragnar_M2 / def_class.py < prev    next >
Text File  |  2000-10-13  |  25KB  |  694 lines

  1. import Bladex
  2. import EnemyTypes
  3. import Enm_Def
  4. import Reference
  5. import AniSound
  6. import Sounds
  7. import Combat
  8. import copy
  9. import Actions
  10. import GameStateAux
  11.  
  12. TRUE = 1
  13. FALSE = 0
  14.  
  15. MESSAGE_START_WEAPON = 7
  16. MESSAGE_STOP_WEAPON = 8
  17.  
  18. #*************************************************************************************************
  19. #*************************************************************************************************
  20. #*************************************************************************************************
  21. #*******************************                                        **************************
  22. #*******************************   Definiciones para DrunkWarder.py     **************************
  23. #*******************************                                        **************************
  24. #*************************************************************************************************
  25. #*************************************************************************************************
  26.  
  27. class DrunkWarder(Enm_Def.NPCPerson):
  28.  
  29.     Durmiendo=0
  30.     Murmurando=0
  31.     Molestado=0
  32.     Muerto=0
  33.     ronquidos=None
  34.     habladormido=None
  35.     molestia=None
  36.     muerte=None
  37.  
  38.     def __init__(self, person):
  39.         Enm_Def.NPCPerson.__init__(self, person)
  40.         self.Durmiendo=0
  41.         self.Murmurando=0
  42.         self.Molestado=0
  43.         self.Muerto=0
  44.         person.SetTmpAnmFlags(1, 1, 0, 0, 1, 1, 0)
  45.         person.LaunchAnimation("Tkn_sleep2")
  46.         person.SetOnFloor()
  47.  
  48.         self.ronquidos=Bladex.CreateSound("..\\..\\Sounds\\snore-loop.wav", "Ronquidos")
  49.         self.ronquidos.Volume=1
  50.         self.ronquidos.Scale=1.0
  51.         self.ronquidos.MinDistance= 5000
  52.         self.ronquidos.MaxDistance=15000
  53.  
  54.         self.habladormido=Bladex.CreateSound("..\\..\\Sounds\\drunk-loop.wav", "HablaDormido")
  55.         self.habladormido.Volume=1
  56.         self.habladormido.Scale=1.0
  57.         self.habladormido.MinDistance= 5000
  58.         self.habladormido.MaxDistance=50000
  59.  
  60.         self.molestia=Bladex.CreateSound("..\\..\\Sounds\\drunk-loop-short.wav", "Molestia")
  61.         self.molestia.Volume=1
  62.         self.molestia.Scale=1.0
  63.         self.molestia.MinDistance= 5000
  64.         self.molestia.MaxDistance=25000
  65.  
  66.         self.muerte=Bladex.CreateSound("..\\..\\Sounds\\knight-die.wav", "Muerte")
  67.         self.muerte.Volume=1
  68.         self.muerte.Scale=1.0
  69.         self.muerte.MinDistance= 5000
  70.         self.muerte.MaxDistance=15000
  71.  
  72.     def Murmura(self, entity_name):
  73. #        print "Murmura..."
  74.         self.Murmurando=1
  75.         if self.Durmiendo:
  76.             self.Durmiendo=0
  77.             self.ronquidos.Stop()
  78.         if self.Molestado:
  79.             self.Molestado=0
  80.             self.molestia.Stop()
  81.         person=Bladex.GetEntity(entity_name)
  82.         person.Wuea=Reference.WUEA_ENDED
  83.         person.LaunchAnimation("Tkn_sleep")
  84.         person.SetOnFloor()
  85.         self.habladormido.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  86.         person.AnmEndedFunc=self.Duerme
  87.  
  88.     def Duerme(self, entity_name):
  89. #        print "Duerme..."
  90.         if self.Muerto:
  91.             return
  92.         self.Durmiendo=1
  93.         if self.Murmurando:
  94.             self.Murmurando=0
  95.         if self.Molestado:
  96.             self.Molestado=0
  97.         person=Bladex.GetEntity(entity_name)
  98.         person.Wuea=Reference.WUEA_ENDED
  99.         person.SetTmpAnmFlags(1, 1, 0, 0, 1, 1, 0)
  100.         person.LaunchAnimation("Tkn_sleep2")
  101.         person.SetOnFloor()
  102.         self.ronquidos.Play(person.Position[0], person.Position[1], person.Position[2], -1)
  103.  
  104.     def Molestia(self, entity_name):
  105. #        print "Se molesta..."
  106.         self.Molestado=1
  107.         if self.Durmiendo:
  108.             self.Durmiendo=0
  109.             self.ronquidos.Stop()
  110.         if self.Murmurando:
  111.             self.Murmurando=0
  112.             self.habladormido.Stop()
  113.         person=Bladex.GetEntity(entity_name)
  114.         person.Wuea=Reference.WUEA_ENDED
  115.         person.LaunchAnimation("Tkn_sleep_hit")
  116.         person.SetOnFloor()
  117.         self.molestia.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  118.         person.AnmEndedFunc=self.Duerme
  119.  
  120.     def Muere(self, entity_name):
  121.         #print "Muere..."
  122.         #Bldb.set_trace()
  123.         if self.Durmiendo:
  124.             self.Durmiendo=0
  125.             self.ronquidos.Stop()
  126.         if self.Murmurando:
  127.             self.Murmurando=0
  128.             self.habladormido.Stop()
  129.         if self.Molestado:
  130.             self.Molestado=0
  131.             self.molestia.Stop()
  132.         person=Bladex.GetEntity(entity_name)
  133.         person.Wuea=Reference.WUEA_ENDED
  134.         person.LaunchAnimation("Tkn_dth_sleep")
  135.         person.SetOnFloor()
  136.         self.muerte.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  137.         self.Muerto=1
  138.  
  139.     # Functions for loading and saving state
  140.     def __getstate__(self):
  141.         #print "DrunkWarder.__getstate__"
  142.         NPCPerson_state=Enm_Def.NPCPerson.__getstate__(self)
  143.         if(NPCPerson_state[0]!=1):
  144.             #print "ERROR: DrunkWarder.__getstate__(): Base class version differs."
  145.             return NPCPerson_state
  146.         NPCPerson_state[1]["DrunkWarder"]=(self.ronquidos.Name,self.habladormido.Name,
  147.                                            self.molestia.Name,self.muerte.Name,
  148.                                            self.Durmiendo,self.Murmurando,self.Molestado,self.Muerto
  149.                                           )
  150.         return NPCPerson_state
  151.     
  152.     def __setstate__(self,parm):
  153.         #print "DrunkWarder.__setstate__"
  154.         # Toma como parΓ«Ñtro lo que devuelve __getstate__() y debe recrear la clase
  155.         Enm_Def.NPCPerson.__setstate__(self,parm)
  156.         version=parm[0]
  157.         if version==1:
  158.             parms=parm[1]["DrunkWarder"]
  159.             self.ronquidos=Bladex.GetSound(parms[0])
  160.             self.habladormido=Bladex.GetSound(parms[1])
  161.             self.molestia=Bladex.GetSound(parms[2])
  162.             self.muerte=Bladex.GetSound(parms[3])
  163.             self.Durmiendo=parms[4]
  164.             self.Murmurando=parms[5]
  165.             self.Molestado=parms[6]
  166.             self.Muerto=parms[7]
  167.  
  168.  
  169. #*************************************************************************************************
  170. #*************************************************************************************************
  171. #*************************************************************************************************
  172. #*******************************                                        **************************
  173. #*******************************   Definiciones para BurningKnights.py **************************
  174. #*******************************                                        **************************
  175. #*************************************************************************************************
  176. #*************************************************************************************************
  177.  
  178. class BurningKnight (EnemyTypes.Knight_Traitor):
  179.     def __init__(self, me):
  180.         #Enm_Def.NPCPerson.__init__(self, me)
  181.         EnemyTypes.Knight_Traitor.__init__(self,me)
  182.         AniSound.AsignarSonidosCaballeroTraidor(me.Name)
  183.         me.Blind=1
  184.         me.Deaf=1
  185.  
  186.  
  187.     def SetOnFire (self,EntityName):
  188.         me = Bladex.GetEntity(EntityName)
  189.         try:
  190.             UserName = me.Data.UsedBy
  191.             user = Bladex.GetEntity(UserName)        
  192.             user_pos = user.Position
  193.         except:
  194.             user_pos = (0.0, 0.0, 0.0)        
  195.         me.CatchOnFire (user_pos[0],user_pos[1], user_pos[2])
  196.  
  197.     def StartRunning (self,EntityName):
  198.         me = Bladex.GetEntity(EntityName)
  199.         Reference.debugprint (EntityName + ": Im starting to run")
  200.         me.ImHurtFunc=self.RunningImHurt
  201.         me.ImDeadFunc=self.RunningImDead
  202.         # Set me alight
  203.         # We need to make this animation interruptable
  204.         #me.SetTmpAnmFlags(0,1,0,0,1,1) 
  205.         me.LaunchAnimation ("Tkn_burn")
  206.         me.AnmEndedFunc=self.StartFalling
  207.  
  208.     def StartFalling (self,EntityName):
  209.         me = Bladex.GetEntity(EntityName)
  210.         # We need to make this animation noninterruptable
  211.         Reference.debugprint (EntityName + ": Im starting to fall")
  212.         me.ImHurtFunc=self.FallingImHurt
  213.         me.ImDeadFunc=self.FallingImDead
  214.         me.SetTmpAnmFlags(1,1,1,0,1,1) 
  215.         me.LaunchAnimation ("Tkn_dth_burn")        
  216.         me.Life=-20
  217.         me.AnmEndedFunc=self.Die
  218.  
  219.     def Die (self,EntityName):
  220.         me = Bladex.GetEntity(EntityName)
  221.         Reference.debugprint (EntityName + ": Dieing")        
  222.  
  223.     def RunningImHurt(self,EntityName):
  224.         me.Wuea=Reference.WUEA_ENDED
  225.         me.LaunchAnmType ("dth0")        
  226.         me.Life=-20
  227.                 
  228.     def RunningImDead(self,EntityName):
  229.         pass    # Do nothing
  230.     
  231.     def FallingImHurt(self,EntityName):        
  232.         pass    # Do nothing
  233.                 
  234.     def FallingImDead(self,EntityName):
  235.         pass    # Do nothing
  236.  
  237. #*************************************************************************************************
  238. #*************************************************************************************************
  239. #*************************************************************************************************
  240. #*******************************                                        **************************
  241. #*******************************   Definiciones para Pendulos.py        **************************
  242. #*******************************                                        **************************
  243. #*************************************************************************************************
  244. #*************************************************************************************************
  245.  
  246.  
  247. class PENDULO:
  248.     Piv = [0,0,4900]
  249.     Axi = [1,0,0]
  250.     Pendulo = 0
  251.     Angulo = 0
  252.     Vel = 0.01
  253.     fAc = -0.004
  254.     sound1 = 0
  255.     sound2 = 0
  256.     Dir = 1    
  257.  
  258.     def Stop(self):
  259.         self.Pendulo.RemoveFromList("Timer30")
  260.         self.Pendulo.MessageEvent(MESSAGE_STOP_WEAPON,0,0)
  261.         self.sound1.StopSound()
  262.         self.sound2.StopSound()
  263.  
  264.     def Play(self):
  265.         self.Pendulo.SubscribeToList("Timer30")
  266.         self.Pendulo.MessageEvent(MESSAGE_START_WEAPON,0,0)
  267.         self.sound1.Position = self.Pendulo.Position[0],12000,self.Pendulo.Position[2]
  268.         self.sound2.Position = self.Pendulo.Position[0],12000,self.Pendulo.Position[2]
  269.         self.sound1.PlaySound(-1)
  270.         self.sound2.PlaySound(-1)
  271.  
  272. #*************************************************************************************************
  273. #*************************************************************************************************
  274. #*************************************************************************************************
  275. #*******************************                                        **************************
  276. #*******************************   Definiciones para Prisioners.py      **************************
  277. #*******************************                                        **************************
  278. #*************************************************************************************************
  279. #*************************************************************************************************
  280.  
  281. class Prisoner(Enm_Def.StupidNPCPerson):
  282.  
  283.   agonia1prs=None
  284.   agonia2prs=None
  285.   muerteprs=None
  286.   Agonizando=0
  287.   Muerto=0
  288.   Desmayado=1
  289.   
  290.  
  291.   def __init__(self, person):
  292.     Enm_Def.StupidNPCPerson.__init__(self, person)
  293.  
  294.     self.agonia1prs=Bladex.CreateSound("..\\..\\Sounds\\moan2.wav", "Agonia1Prs")
  295.     self.agonia1prs.Volume=1
  296.     self.agonia1prs.Scale=1.112
  297.     self.agonia1prs.MinDistance= 5000
  298.     self.agonia1prs.MaxDistance=25000
  299.  
  300.     self.agonia2prs=Bladex.CreateSound("..\\..\\Sounds\\moan2.wav", "Agonia2Prs")
  301.     self.agonia2prs.Volume=1
  302.     self.agonia2prs.Scale=1.112
  303.     self.agonia2prs.MinDistance= 5000
  304.     self.agonia2prs.MaxDistance=25000
  305.  
  306.     self.muerteprs=Bladex.CreateSound("..\\..\\Sounds\\knight-die.wav", "MuertePrs")
  307.     self.muerteprs.Volume=1
  308.     self.muerteprs.Scale=1.112
  309.     self.muerteprs.MinDistance= 5000
  310.     self.muerteprs.MaxDistance=25000
  311.  
  312.     self.Agonizando=0
  313.     self.Muerto=0
  314.     self.Desmayado=1
  315.     self.Desmaya(self.Name)
  316.  
  317.   def Agoniza(self, entity_name):
  318.     #print "Agoniza..."+entity_name
  319.     if self.Muerto:
  320.       return
  321.     if self.Desmayado:
  322.       self.Desmayado=0
  323.     person=Bladex.GetEntity(entity_name)
  324.     if entity_name=="PrisioneroVivo1":
  325.       person.Wuea=Reference.WUEA_ENDED
  326.       person.LaunchAnimation("Prs_agony01")
  327.       person.SetOnFloor()
  328.       self.agonia1prs.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  329.       self.Agonizando=1
  330.     else:
  331.       person.Wuea=Reference.WUEA_ENDED
  332.       person.LaunchAnimation("Prs_agony02")
  333.       person.SetOnFloor()
  334.       self.agonia2prs.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  335.       self.Agonizando=2
  336.     person.AnmEndedFunc=self.Desmaya
  337.  
  338.   def Desmaya(self, entity_name):
  339.     #print "Desmayado..."+entity_name
  340.     if self.Muerto:
  341.       return
  342.     self.Desmayado=1
  343.     if self.Agonizando:
  344.       self.Agonizando=0
  345.     person=Bladex.GetEntity(entity_name)
  346.     person.SetTmpAnmFlags(1, 1, 0, 0, 1, 1)
  347.     if entity_name=="PrisioneroVivo1":
  348.       person.Wuea=Reference.WUEA_ENDED
  349.       person.LaunchAnimation("Prs_rlx_01")
  350.       person.SetOnFloor()
  351.     else:
  352.       person.Wuea=Reference.WUEA_ENDED
  353.       person.LaunchAnimation("Prs_rlx_02")
  354.       person.SetOnFloor()
  355.  
  356.   def Muere(self, entity_name):
  357.     #print "Muere..."+entity_name
  358.     if self.Desmayado:
  359.       self.Desmayado=0
  360.     if self.Agonizando:
  361.       if self.Agonizando==1:
  362.         self.agonia1prs.Stop()
  363.       else:
  364.         self.agonia2prs.Stop()
  365.       self.Agonizando=0
  366.     person=Bladex.GetEntity(entity_name)
  367.     person.Wuea=Reference.WUEA_ENDED
  368.     person.LaunchAnimation("Prs_dth")
  369.     person.SetOnFloor()
  370.     self.muerteprs.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  371.     self.Muerto=1
  372.  
  373.  
  374.   # Functions for loading and saving state
  375.   def __getstate__(self):
  376.     #print "Prisoner.__getstate__"
  377.     NPCPerson_state=Enm_Def.StupidNPCPerson.__getstate__(self)
  378.     if(NPCPerson_state[0]!=1):
  379.       #print "ERROR: Prisoner.__getstate__(): Base class version differs."
  380.       return NPCPerson_state
  381.  
  382.     NPCPerson_state[1]["Prisoner"]=(self.agonia1prs.Name,
  383.                           self.agonia2prs.Name,
  384.                           self.muerteprs.Name,
  385.                           self.Agonizando,
  386.                           self.Muerto,
  387.                           self.Desmayado
  388.                          )
  389.     return NPCPerson_state
  390.   
  391.   def __setstate__(self,parm):
  392.     #print "Prisoner.__setstate__"
  393.     # Toma como parΓ«Ñtro lo que devuelve __getstate__() y debe recrear la clase
  394.     Enm_Def.StupidNPCPerson.__setstate__(self,parm)
  395.     version=parm[0]
  396.     if version==1:
  397.       parms=parm[1]["Prisoner"]
  398.       self.agonia1prs=Bladex.GetSound(parms[0])
  399.       self.agonia2prs=Bladex.GetSound(parms[1])
  400.       self.muerteprs=Bladex.GetSound(parms[2])
  401.       self.Agonizando=parms[3]
  402.       self.Muerto=parms[4]
  403.       self.Desmayado=parms[5]
  404.  
  405.  
  406.  
  407.  
  408.  
  409. #*************************************************************************************************
  410. #*************************************************************************************************
  411. #*************************************************************************************************
  412. #*******************************                                        **************************
  413. #*******************************   Definiciones para Trampa_flechas.py  **************************
  414. #*******************************                                        **************************
  415. #*************************************************************************************************
  416. #*************************************************************************************************
  417.  
  418. class FLECHA:
  419.     def __init__(self):
  420.         self.Nombre = ""
  421.         self.Lanzar = ""
  422.         self.Flechas_Clavadas = 0
  423.         self.Estado = 0
  424.         self.Avance = 0
  425.         self.Orientation = [0,0,0,0]
  426.         self.Position = [0,0,0]
  427.         self.Scale = 0
  428.         self.Tiempo_Lanzamiento = 2
  429.         self.Tiempo_Parada       = 0.9
  430.         self.Sound = 0
  431.  
  432. #*************************************************************************************************
  433. #*************************************************************************************************
  434. #*************************************************************************************************
  435. #*******************************                                        **************************
  436. #*******************************   Definiciones para Talking_Knights.py **************************
  437. #*******************************                                        **************************
  438. #*************************************************************************************************
  439. #*************************************************************************************************
  440.  
  441. class TalkingKnight (EnemyTypes.Knight_Traitor):
  442.  
  443.     Guard1=None
  444.     Guard2=None
  445.  
  446.     def __init__(self, me):
  447.         EnemyTypes.Knight_Traitor.__init__(self, me)    
  448.         
  449.         self.Guard1=Sounds.CreateEntitySound('..\\..\\sounds\\guard1.wav', 'GuardTalk1')
  450.         self.Guard1.Volume = 1.0
  451.         self.Guard1.MinDistance= 5000
  452.         self.Guard1.MaxDistance=25000
  453.         self.Guard2=Sounds.CreateEntitySound('..\\..\\sounds\\guard2.wav', 'GuardTalk2')
  454.         self.Guard2.Volume = 1.0
  455.         self.Guard2.MinDistance= 5000
  456.         self.Guard2.MaxDistance=25000
  457.     
  458.     def StopTalking (self,EntityName):        
  459.         me = Bladex.GetEntity(EntityName)
  460.         me.HearFunc = self.ExHearFunc
  461.         me.SeeFunc = self.ExSeeFunc
  462.         me.SetOnFloor()
  463.  
  464.         if (EntityName == "Terry"):
  465.             #me.Angle = 0.5
  466.             #self.Guard2.Stop()
  467.             self.Guard2.Volume = 0
  468.         else:
  469.             #me.Angle = 5.5
  470.             #self.Guard1.Stop()
  471.             self.Guard1.Volume = 0
  472.  
  473.         Actions.QuickTurnToFaceEntity(me.Name,"Player1")
  474.         me.SetActiveEnemy(Bladex.GetEntity("Player1"))
  475.  
  476.     def LaunchSound1(self):
  477.         self.Guard1.PlaySound(0)
  478.  
  479.     def LaunchSound2(self):
  480.         self.Guard2.PlaySound(0)
  481.  
  482.     def HearEvent(self,EntityName,SoundName, x, y, z, Volume):
  483.         self.StopTalking(EntityName)
  484.  
  485.     def StartTalking1 (self):
  486.         me = Bladex.GetEntity(self.Name)
  487.         friend = Bladex.GetEntity("Terry")
  488.  
  489.         if me and me.Life > 0 and me.GetActionMode() == Enm_Def.ROUTE_WATCH and friend and friend.GetActionMode() == Enm_Def.ROUTE_WATCH:
  490.             me.SetSound("")
  491.             Bladex.AddScheduledFunc(Bladex.GetTime() + 6.0/20.0,self.LaunchSound1,())
  492.             self.Guard1.Position = me.Position
  493.             self.ExHearFunc = me.HearFunc
  494.             self.ExSeeFunc = me.SeeFunc
  495.             me.HearFunc = self.HearEvent
  496.             me.SeeFunc = self.StopTalking
  497.             Reference.debugprint (self.Name + ": Im starting to talk")
  498.             me.SetTmpAnmFlags(1,1,1,0,3,1,0) # no cicla, colisiona y no hace transicion
  499.             me.LaunchAnimation ("Tkn_speak01")
  500.             me.AnmEndedFunc=self.StopTalking
  501.             me.SetOnFloor()
  502.  
  503.     def StartTalking2 (self):
  504.         me = Bladex.GetEntity(self.Name)
  505.         friend = Bladex.GetEntity("Eric")
  506.         if me and me.Life > 0 and me.GetActionMode() == Enm_Def.ROUTE_WATCH and friend and friend.GetActionMode() == Enm_Def.ROUTE_WATCH:
  507.             me.SetSound("")
  508.             Bladex.AddScheduledFunc(Bladex.GetTime() + 3.0,self.LaunchSound2,())
  509.             self.Guard2.Position = me.Position
  510.             self.ExHearFunc = me.HearFunc
  511.             self.ExSeeFunc = me.SeeFunc
  512.             me.HearFunc = self.HearEvent
  513.             me.SeeFunc = self.StopTalking            
  514.             Reference.debugprint (self.Name + ": Im starting to talk")
  515.             me.SetTmpAnmFlags(1,1,1,0,3,1,0) # no cicla, colisiona y no hace transicion
  516.             me.LaunchAnimation ("Tkn_speak02")
  517.             me.AnmEndedFunc=self.StopTalking
  518.             me.SetOnFloor()
  519.  
  520.     # Functions for loading and saving state
  521.     def __getstate__(self):
  522.         #print "TalkingKnight.__getstate__"
  523.         NPCPerson_state=EnemyTypes.Knight_Traitor.__getstate__(self)
  524.         if(NPCPerson_state[0]!=1):
  525.             #print "ERROR: TalkingKnight.__getstate__(): Base class version differs."
  526.             return NPCPerson_state
  527.         NPCPerson_state[1]["TalkingKnight"]=(
  528.                                             GameStateAux.SaveEntityAux(self.Guard1),
  529.                                             GameStateAux.SaveEntityAux(self.Guard2)
  530.                                             )
  531.         return NPCPerson_state
  532.     
  533.     def __setstate__(self,parm):
  534.         #print "TalkingKnight.__setstate__"
  535.         # Toma como parΓ«Ñtro lo que devuelve __getstate__() y debe recrear la clase
  536.         EnemyTypes.Knight_Traitor.__setstate__(self,parm)
  537.         version=parm[0]
  538.         if version==1:
  539.             parms=parm[1]["TalkingKnight"]
  540.             self.Guard1=GameStateAux.LoadEntityAux(parms[0])
  541.             self.Guard2=GameStateAux.LoadEntityAux(parms[1])
  542.  
  543.  
  544. #*************************************************************************************************
  545. #*************************************************************************************************
  546. #*************************************************************************************************
  547. #*******************************                                        **************************
  548. #*******************************   Definiciones para Sleeping_Knight.py **************************
  549. #*******************************                                        **************************
  550. #*************************************************************************************************
  551. #*************************************************************************************************
  552.  
  553. class SleepingKnight (EnemyTypes.Knight_Traitor):
  554.  
  555.     ronquidos=None
  556.     SleepXOffset = 500
  557.  
  558.  
  559.     def __init__(self, me):
  560.         EnemyTypes.Knight_Traitor.__init__(self, me)
  561.         self.ronquidos=Sounds.CreateEntitySound("..\\..\\Sounds\\snore-loop.wav", "Ronquidos2")
  562.         self.ronquidos.Volume=1
  563.         #self.ronquidos.Scale=1.112
  564.         self.ronquidos.MinDistance= 5000
  565.         self.ronquidos.MaxDistance=15000
  566.  
  567.         self.PutMeToSleep(self.Name)
  568.         me.ImDeadFunc=self.ImDeadFuncJodete
  569.     
  570.     def ImDeadFuncJodete (self,EntityName):
  571.         Enm_Def.NPCPerson.StdImDead(self,EntityName)
  572.         me = Bladex.GetEntity(EntityName)
  573.         me.Wuea=Reference.WUEA_ENDED
  574.         me.LaunchAnmType("dth0")
  575.         self.ronquidos.StopSound()
  576.  
  577.     # We sleep against a wall rather than on the floor, so override the basic sleep funcs
  578.  
  579.     def PutMeToSleep(self,EntityName):
  580.         if not self.Asleep:
  581.             me = Bladex.GetEntity(EntityName)
  582.  
  583.             self.SleepXOffset = 500
  584.             #me.Position = (me.Position[0]-self.SleepXOffset, me.Position[1], me.Position[2])
  585.             me.Wuea=Reference.WUEA_ENDED
  586.             me.SetTmpAnmFlags(1,1,0,0,0,1,1)
  587.             me.LaunchAnimation("Tkn_sleep_wall")
  588.             me.Blind=1  #just in case
  589.             #me.Deaf=1
  590.             self.Asleep = TRUE            
  591.             Bladex.AddScheduledFunc(Bladex.GetTime() + 30.0,self.RePlaySounds,(me,))
  592.     
  593.     def RePlaySounds(self,me):
  594.             self.ronquidos.Position = me.Position
  595.             self.ronquidos.PlaySound(-1)
  596.  
  597.  
  598.     def WakeMeUp(self,EntityName):
  599.         if self.Asleep:
  600.             me = Bladex.GetEntity(EntityName)
  601.             me.Blind=0  #just in case
  602.             self.ronquidos.StopSound()
  603.  
  604.             # alert animation
  605.             if me.AnimName[:5] == "Sleep" or me.AnimName[:5] == "sleep":
  606.                 me.Position = -75975,-6100,53688
  607.                 me.Wuea=Reference.WUEA_ENDED
  608.                 me.SetTmpAnmFlags(1,0,1,0,1,1)
  609.                 me.LaunchAnimation("Tkn_alarm01")                
  610.                 me.SetOnFloor()
  611.             self.Asleep = FALSE            
  612.  
  613.  
  614.     # Functions for loading and saving state
  615.     def __getstate__(self):
  616.         #print "SleepingKnight.__getstate__"
  617.         NPCPerson_state=EnemyTypes.Knight_Traitor.__getstate__(self)
  618.         if(NPCPerson_state[0]!=1):
  619.             #print "ERROR: SleepingKnight.__getstate__(): Base class version differs."
  620.             return NPCPerson_state
  621.         NPCPerson_state[1]["SleepingKnight"]=(GameStateAux.SaveEntityAux(self.ronquidos),
  622.                                               self.SleepXOffset
  623.                                               )
  624.         return NPCPerson_state
  625.     
  626.     def __setstate__(self,parm):
  627.         #print "SleepingKnight.__setstate__"
  628.         # Toma como parΓ«Ñtro lo que devuelve __getstate__() y debe recrear la clase
  629.         EnemyTypes.Knight_Traitor.__setstate__(self,parm)
  630.         version=parm[0]
  631.         if version==1:
  632.             parms=parm[1]["SleepingKnight"]
  633.             self.ronquidos=GameStateAux.LoadEntityAux(parms[0])
  634.             self.SleepXOffset=parms[1]
  635.  
  636.  
  637.  
  638.  
  639. #*************************************************************************************************
  640. #*************************************************************************************************
  641. #*************************************************************************************************
  642. #*******************************                                        **************************
  643. #*******************************   Definiciones para Ragnar_Actions.py  **************************
  644. #*******************************                                        **************************
  645. #*************************************************************************************************
  646. #*************************************************************************************************
  647.  
  648. ##class RagnarActions(Enm_Def.NPCPerson):
  649. ##    def __init__(self, person):
  650. ##        # base class init
  651. ##        Enm_Def.NPCPerson.__init__(self, person)
  652. ##        
  653. ##        # Set up orc specific sound priorities        
  654. ##        self.SoundPriorities[Reference.SND_ARROW] = 10.0
  655. ##        self.SoundPriorities[Reference.SND_HIT] = 50.0
  656. ##        self.SoundPriorities[Reference.SND_NPC] = 25.0
  657. ##        self.SoundPriorities[Reference.SND_NOISYPC] = 30.0
  658. ##        self.SoundPriorities[Reference.SND_PC] = 80.0
  659. ##
  660. ##        self.risaragnar=Bladex.CreateSound("..\\..\\Sounds\\risa-ragnar.wav", "RisaRagnar")
  661. ##        self.risaragnar.Volume=1
  662. ##        #self.risaragnar.Scale=0.56
  663. ##        #self.risaragnar.MinDistance= 5000
  664. ##        #self.risaragnar.MaxDistance=90000
  665. ##        self.risaragnar.Scale=3.41
  666. ##        self.risaragnar.MinDistance= 5000
  667. ##        self.risaragnar.MaxDistance=90000
  668. ##
  669. ##
  670. ##    def Laugh(self, entity_name):
  671. ##        person=Bladex.GetEntity(self.Name)
  672. ##        self.risaragnar.Play(person.Position[0], person.Position[1], person.Position[2], 0)
  673. ##
  674. ##    def Escaping(self, risa=0):
  675. ##        person=Bladex.GetEntity(self.Name)
  676. ##        person.LaunchAnimation("Rgn_escape")
  677. ##        if risa:
  678. ##            person.AnmEndedFunc=self.Laugh
  679. ##
  680. ##    def CommandingAndEscaping(self, risa=0):
  681. ##        person=Bladex.GetEntity(self.Name)
  682. ##        person.LaunchAnimation("Rgn_escape2")
  683. ##        if risa:
  684. ##            person.AnmEndedFunc=self.Laugh
  685. ##
  686. ##    def ResetCombat (self,EntityName):
  687. ##        Enm_Def.NPCPerson.ResetCombat(self, EntityName)
  688. ##        me = Bladex.GetEntity(EntityName)    
  689. ##        if me and me.Life>0:
  690. ##            self.AttacksOwnKind=0
  691. ##            self.ChanceOfFury = 0.00
  692. ##            me.BlockingPropensity = 0.2
  693. ##            me.AttackList = copy.copy(Combat.RagnarAttackData)
  694.